#ifndef H_THREADS_20071014
#define H_THREADS_20071014

#include "extern.h"
#include "net.h"
#include "macros.h"
#include "types.h"
#include "hashtables.h"
#include "str.h"
#include "db.h"
#include "linkedlists.h"
#include "macros.h"
#include "header.h"

int thread_create_all (void);
Thread* thread_new (pthread_t thid);
int thread_create (pthread_t * thread, pthread_attr_t * attr, void * (*start_routine)(void *), void * arg);

void* thread_func_poll (void* arg);
void* thread_func_ping (void* arg);
void* thread_func_admin (void* arg);
void* thread_func_auth (void* arg);

void thread_kill_all (void);
void thread_kill (pthread_t th);
void thread_exit (void* retval);

Thread* thread_get_by_num (int num);
void thread_client_insert (Client* client);


#define		THREAD_UPDATE_POS(insert)	((insert==ServerConf.PollThreads)?1:insert+1)


#endif
